import request from "@/utils/request";

const api_name = "/admin/product/unit";
// 分页查询商品规格
export const GetProductUnitPageList = (pageNum, pageSize, name) => {
  return request({
    url: `${api_name}/page`,
    method: "post",
    data: {
      pageNum,
      pageSize,
      name
    }
  });
};

//商品单位操作：有ID更新，无ID新增
export const UpdateProductUnit = ProductUnit => {
  return request({
    url: `${api_name}/operate`,
    method: "post",
    data: ProductUnit
  });
};

// 根据id删除商品规格
export const Delete = id => {
  return request({
    url: `${api_name}/remove/${id}`,
    method: "delete"
  });
};

// 获取商品单位列表
export const FindAllProductUnit = () => {
  return request({
    url: `${api_name}/all`,
    method: "GET"
  });
}
